# coding:utf-8

#1datetime包---------------------------------------------------------------
# from datetime import datetime
# from datetime import timedelta
#
# now = datetime.now()
# print(now,type(now))
# now_str = now.strftime('%Y-%m-%d %H:%M:%S')
# print(now_str,type(now_str))
# now_obj = datetime.strptime(now_str,'%Y-%m-%d %H:%M:%S')
# print(now_obj,type(now_obj),'--------')
#
# three_days = timedelta(days=3)
# after_three_day = now+three_days
# after_three_day_str = after_three_day.strftime('%Y/%m/%d')
# print(after_three_day_str,type(after_three_day_str))
# print(after_three_day)
# after_three_day_obj = datetime.strptime(after_three_day_str,'%Y/%m/%d')
# print(after_three_day_obj,type(after_three_day_obj),'====')
#
#
# before_three_day = now - three_days
# before_three_day_str = before_three_day.strftime('%Y%m%d')
# print(before_three_day_str,type(before_three_day_str))
# print(before_three_day)
#
#
# one_hour = timedelta(hours=1)
# before_one_hour = now-one_hour
# print(before_one_hour)
#
# default_str = '2020 12 abc'
# print(datetime.strptime(default_str,'%Y %m %d'))


#2time时间包--------------------------------------------------

# import time
# import datetime

# now = time.time()
# print(now,type(now))
#
# time_obj = time.localtime(now)
# print(time_obj,type(time_obj))
# # time.sleep(5)
# current_time_obj = time.localtime()
# print(current_time_obj)
#
# before = now - 100000
# before_time_obj = time.localtime(before)
# print(before_time_obj)
#
# print(time.time()*1000)
# print(time.time())

# for i in range(10):
#     print(i)
#     time.sleep(1)

# datetime_now = datetime.datetime.now()
# datetime_timestamp = datetime.datetime.timestamp(datetime_now)
# print('datetime 生成的时间戳 %s' % datetime_timestamp)
#
# datetime_obj = datetime.datetime.fromtimestamp(datetime_timestamp)
# print(datetime_obj)

#3python中的os包--------------------------------------------------------

# import os
#
# current_path = os.getcwd()
# current_path = current_path + '/package_test.py'
# print(current_path)
# print(os.path.isabs(current_path))
# new_path = '%s/test1' % current_path
# print(os.path.exists(new_path))
# if os.path.exists(new_path):
#     os.makedirs(new_path)
# # os.makedirs(new_path)
#
# # date = os.listdir(current_path)
# # print(date)
#
# new_path2 = os.path.join(current_path,'test2','abc')
# print(new_path2)
#
# if os.path.exists(new_path2):
#     os.makedirs(new_path2)
# print(os.path.split(new_path2))
# print(os.path.isfile(current_path))
# #  new_path2 = '%s/test2/abc' % current_path
# #  os.makedirs(new_path2)
# #
# #  os.makedirs('test3')
# #
# #  os.removedirs('test2/abc')
# #  os.rename('test3','test3_new')
# #
# #  os.rename('package_datetime.py','package_test.py')
# #
# #  os.rmdir('%s/test3_new' % current_path)
# # os.rmdir('test1')

#4python 中的system模块--------------------------------------------

import sys

command = sys.argv[1]
if command == 'modules':
    modules = sys.modules
    print(modules)
elif command =='path':
    path = sys.path
    print(path)
elif command =='encoding':
    code =sys.getdefaultencoding()
    print(code)
elif command =='platform':
    print(sys.platform)
elif command =='version':
    print(sys.version)
else:
    print('not command')
